package Entity;

import java.util.Date;
import java.util.Collection;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(schema="poleinfodb", name = "auctionssoffer")
@PrimaryKeyJoinColumn(name="ID_OFFER")
public class AuctionOffer extends Offer{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 4592983180242309949L;

	@Basic(optional=false)
	private double startPrice;
	
	@Basic(optional=false)
	private double currentPrice;
	
	@Temporal(TemporalType.DATE)
	private Date startDate;
	
	@Temporal(TemporalType.DATE)
	private Date finalDate;
	
	public AuctionOffer(Collection<Contract> contracts,
			double startPrice, double currentPrice, Date startDate, Date finalDate) {
		super(contracts);
		this.startPrice = startPrice;
		this.currentPrice = currentPrice;
		this.startDate = startDate;
		this.finalDate = finalDate;
	}
	
	public AuctionOffer(double startPrice, double currentPrice, Date startDate, Date finalDate) {
		super();
		this.startPrice = startPrice;
		this.currentPrice = currentPrice;
		this.startDate = startDate;
		this.finalDate = finalDate;
	}

	@Override
	public String toString() {
		return "AuctionOffer [startPrice=" + startPrice + ", currentPrice="
				+ currentPrice + ", startDate=" + startDate + ", finalDate="
				+ finalDate + "]";
	}

	public double getStartPrice() {
		return startPrice;
	}

	public void setStartPrice(double startPrice) {
		this.startPrice = startPrice;
	}

	public double getCurrentPrice() {
		return currentPrice;
	}

	public void setCurrentPrice(double currentPrice) {
		this.currentPrice = currentPrice;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getFinalDate() {
		return finalDate;
	}

	public void setFinalDate(Date finalDate) {
		this.finalDate = finalDate;
	}
}
